<?php
if (!defined('ZAZA')) exit('No direct script access allowed');
/**
 * @copyright     ZaZa Group
 * @author        Sir Doan
 */

class AdminPageAdd extends Form
{
    function __construct()
    {                          
        Form::__construct('AdminPageAddForm');
        tpl()->layout = 'admin';  
    } 
    // Method Submit
    function is_submit()
    {
         $pageInfo = array( 'name' => Obj()->get('name'), 
                            'description' => Obj()->get('description'), 
                            'type' => Obj()->get('type', 'int', 0));
         require_once MODEL_PATH . DS .'AdminPage_model.php';
         $objPage = new AdminPage_Model();
         $res = $objPage->add($pageInfo);
         if($res)
            Url::redirectUrl(Url::buildUrl(null, 'admin_page', true), true);
    } 
    // Method Draw
    function draw()
    {              
        tpl()->assign('form', array('begin' => $this->begin(), 'end' => $this->end()));
        return tpl()->display('admin_page_add'); 
    }
}  
?>
